package com.mercury.base.exception;


import com.mercury.base.result.code.IRespCode;

/**
 * 自定义异常
 *
 * @author mercury
 * @date 2021/1/15 4:13 下午
 */
public class CustomException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    private final String code;

    private final String message;

    private final Object data;

    public CustomException(IRespCode code, Object data) {
        this.code = code.getRespCode();
        this.message = code.getMessage();
        this.data = data;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public String getCode() {
        return code;
    }


    public Object getData() {
        return data;
    }
}
